#include "drv_seg.h"
#include "drv_spi.h"
#include "drv_systick.h"
static uint8_t d[]={0x3F, 0x06,0x5B,  0x4F, 0x66,  0x6D, 0x7D, 0x07, 0x7F,  0x6F};
static uint8_t w[]={0x08, 0x04, 0x02,0x01};
                       
void drv_74hc595_init(void)
{
	drv_spi2_init();
}
void drv_seg_display(uint8_t wei,uint8_t duan)
{
	drv_spi2_senddata(w[wei]);
	drv_spi2_senddata(d[duan]);
	GPIO_ResetBits(GPIOB, GPIO_Pin_12);
	drv_systick_ms(1);
	GPIO_SetBits(GPIOB, GPIO_Pin_12);

	
}

void drv_seg_show(int a,int b,int c,int x)
{
	drv_spi2_senddata(0x0f);
	drv_spi2_senddata(d[a]);
	drv_spi2_senddata(d[b]);
	drv_spi2_senddata(d[c]);
	drv_spi2_senddata(d[x]);
	GPIO_ResetBits(GPIOB, GPIO_Pin_12);
	drv_systick_ms(1);
	GPIO_SetBits(GPIOB, GPIO_Pin_12);

	
}

